<template>
    <h2>房型管理添加</h2>
    <table class="table table-bordered">
        <tbody>
            <tr class="bg-primary">
                <td>房间类型</td>
                <td>房型</td>
                <td>状态</td>
                <td>操作</td>
            </tr>
            <tr v-for="item in roomHaoShow">
                <td>{{ item.name }}</td>
                <td>{{ item.roomType }}</td>
                <td>{{ item.start ? "上架" : "下架" }}</td>
                <td>
                    <a @click="Upstart(item.id)" style="color: red;">上架</a>
                    <a @click="Upstart(item.id)" style="color: blue;">下架</a>
                </td>
            </tr>
        </tbody>
    </table>
</template>
<script setup lang="ts">
//引入组件
import { ref, reactive, onMounted } from "vue"
//bootstrap样式
import "bootstrap/dist/css/bootstrap.min.css"
//访问后端
import axios from "axios"
//路由(1)
import { useRouter } from "vue-router";

const router = useRouter();
const roomHaoShow = ref([])
const getroomHaoShow = () => {
    axios.get("http://localhost:5256/api/RoomHao/GetShow").then(res => {
        roomHaoShow.value = res.data;
    })
}
onMounted(() => {
    getroomHaoShow();
})
</script>